package r25.character;

import r25.engine.IGameInstance.CHARACTER_ACTION;
import r25.room.IRoom;
import r25.tools.IdGenerator;

public abstract class AbstractInRoomObject implements IInRoomObject {
	private IRoom room;
	private String name;
	private final String id;

	public AbstractInRoomObject() {
		id = IdGenerator.createId();
	}

	@Override
	public IRoom getRoomIn() {
		return room;
	}

	@Override
	public CHARACTER_ACTION moveInRoom(IRoom room) throws Exception {
		this.room = room;
		return null;
	}

	@Override
	public String getId() {
		return id;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public void setName(String name) {
		this.name = name;
	}

	@Override
	public int hashCode() {
		return this.getId().hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if ((obj == null) || (this.getClass() != obj.getClass()))
			return false;

		IInRoomObject ro = (IInRoomObject) obj;

		return this.getId().equals(ro.getId());
	}
}
